package com.sz.biz.logistics.serialno.constants;

import java.util.HashMap;
import java.util.Map;

/**
 * Package: com.sz.biz.logistics.channel<br>
 * Description: 单号相关常量<br>
 * @author WuHan<br>
 * @date 2017-12-07 16:46<br>
 * @serial
 * @since ${TAG}
 */
public interface BillNumberConstants {
    
    /**
     * 符号常量部分
     */
    class Symbols {
    
        /**
         * #代表字母
         */
        public static final String SYMBOL_LETTER = "#";
    
        /**
         * *代表数字
         */
        public static final String SYMBOL_DIGIT = "*";
    
        /**
         * !代表字母/数字
         */
        public static final String SYMBOL_MIXED = "!";
    
        /**
         * ?代表校验位
         */
        public static final String SYMBOL_VERIFYCODE = "?";
    
        /**
         * -代表分隔符
         */
        public static final String SYMBOL_SEPERATOR = "-";
        public static final String SYMBOL_SEMICOLON_EN = ";";
        public static final String SYMBOL_SEMICOLON_CN = "；";
    }
    
    /**
     * 正则表达式部分
     */
    class Regexs {
    
        /**
         * 范围定界符'{'
         */
        public static final String OPENING_RANGE_BRACKET = "{";
    
        /**
         * 范围定界符'}'
         */
        public static final String CLOSING_RANGE_BRACKET = "}";
    
        /**
         * 整体定界符'('
         */
        public static final String OPENING_BULK_BRACKET = "(";
    
        /**
         * 整体定界符')'
         */
        public static final String CLOSING_BULK_BRACKET = ")";
    
        /**
         * 纯数字标识
         */
        public static final String PURE_DIGIT = "[0-9]";
    
        /**
         * 纯字母标识
         */
        public static final String PURE_LETTER = "[A-Z]";
    
        /**
         * 数字/字母混合标识
         */
        public static final String MIXED_CHARACTER = "[A-Z0-9]";
    
        /**
         * 重复匹配符号
         */
        public static final String MULTIPLE_MATCHER = "+";
    
        /**
         * 起始限定符
         */
        public static final String START_RESTRICTOR = "^";
    
        /**
         * 终止限定符
         */
        public static final String END_RESTRICTOR = "$";
    
        /**
         * 转义的斜杠
         */
        public static final String DOUBLE_SLASH = "\\";
    
        /**
         * 非通配符
         */
        public static final String NON_WILDCARD = "[^*#!?]";
    
        /**
         * 非数字
         */
        public static final String NON_DIGIT = "[^0-9]";
    
        /**
         * 通配符
         */
        public static final String WILDCARDS = "[*#!]";
    
        /**
         * 运单号序列部分
         */
        public static final String WAYBILLNUMBER_REGEX = "[0-9]{9}";
    }
    
    class Characters {
    
        /**
         * 空字符
         */
        public static final String EMPTY_STRING = "";
        
        /**
         * 纯数字类型的起始值
         */
        public static final String NUMBER_START = "0";
        
        /**
         * 纯数字类型的结尾值
         */
        public static final String NUMBER_END = "9";
        
        /**
         * 纯字母类型的起始值
         */
        public static final String LETTER_START = "A";
        
        /**
         * 纯字母类型的结尾值
         */
        public static final String LETTER_END = "Z";
        
        /**
         * 数字/字母混合类型的起始值
         */
        public static final String MIXED_CHARACTER_START = "0";
        
         /**
         * 数字/字母混合类型的结尾值
         */
        public static final String MIXED_CHARACTER_END = "Z";
    
        /**
         * 空格
         */
        public static final String BLANK = " ";
    }

    class RuleCreateMethod {
        
        /**
         * 自动生成
         */
        public static final int AUTO = 1;
        
        /**
         * 手动生成
         */
        public static final int MANUAL = 2;
    }

    class RuleStatus {
        
        /**
         * 未启用
         */
        public static final int NOTENABLED = 1;
        
        /**
         * 启用
         */
        public static final int ENABLED = 2;
        /**
         * 停用
         */
        public static final int DISABLED = 3;
    }
    
    class PatternParse {
    
        /**
         * 数字的个数
         */
        public static final int NUMBER_BASE = 10;
    
        /**
         * 字母的个数
         */
        public static final int LETTER_BASE = 26;
    
        /**
         * 数字/字母的个数
         */
        public static final int MIXCHAR_BASE = 36;
    
        /**
         * 待选字符表
         */
        public static final char[] CHARACTER_INTEGER_ARRAY = {
                '0', '1', '2', '3', '4',
                '5', '6', '7', '8', '9',
                'A', 'B', 'C', 'D', 'E',
                'F', 'G', 'H', 'I', 'J',
                'K', 'L', 'M', 'N', 'O',
                'P', 'Q', 'R', 'S', 'T',
                'U', 'V', 'W', 'X', 'Y',
                'Z'
        };
    
        /**
         * 字符→顺序映射
         */
        public static final Map<Character, Integer> CHARACTER_INTEGER_MAP = new HashMap() {
            {
                int i = 0;
                for (char c : CHARACTER_INTEGER_ARRAY) {
                    put(c, i);
                    i++;
                }
            }
        };
    
        /**
         * 计算出的单号起始值
         */
        public static final String START_CHANNEL_NUMBER = "startChannelNumber";
    
        /**
         * 计算出的单号结尾值
         */
        public static final String END_CHANNEL_NUMBER = "endChannelNumber";
    
        /**
         * 计算出的单号范围
         */
        public static final String CHANNEL_NUMBER_RANGE = "range";
    }

    class ChannelNoStatus {
        
        /**
         * 渠道单号已使用
         */
        public static final int USED = 1;
        
        /**
         * 渠道单号未使用
         */
        public static final int UNUSED = 0;
    }

    class ChannelNoCreateMethod {
        
        /**
         * 自动
         */
        public static final int AUTO = 0;
        
        /**
         * 手动
         */
        public static final int MANUAL = 1;
        
        /**
         * 手动导入
         */
        public static final int MANUAL_IMPORT = 2;
    }

    class ChannelNoticeType {
    
        /**
         * 电子邮件
         */
        public static final String EMAIL = "email";
    
        /**
         * 短信
         */
        public static final String SMS = "sms";
    }

    class AlgorithmInfo {
    
        /**
         * 限定模式串长度的加权校验算法
         */
        public static final String RESTRICTED_WEIGHT_ARRAY_ALGORITHM = "REWeight";
    
        /**
         * 运单号专用的生成算法
         */
        public static final String WAYBILL_NUMBER_ALGORITHM = "WBA";
    }
    
    /**
     * 单号类型
     */
    class NumberType {
        /**
         * 渠道单号
         */
        public static final Integer CHANNEL_NUMBER = 1;
    
        /**
         * 运单号
         */
        public static final Integer WAYBILL_NUMBER = 2;
    }
}
